/*
 * Write a C++ program using friend function
 * to find the mean of two numbers
 */
# include <iostream>
using namespace std;

class FriendMean {
  int a, b;
public:
  void get(int n1, int n2);
  friend void::calcMean(FriendMean& fm);
};

void FriendMean::get(int n1, int n2) {
  a = n1;
  b = n2;
}

void calcMean(FriendMean& fm) {
  cout << (fm.a + fm.b) / 2 << endl;
}

int main() {
  int n1, n2;
  cout << "Enter number 1: ";
  cin >> n1;
  cout << "Enter number 2: ";
  cin >> n2;
  FriendMean fm;
  fm.get(n1, n2);
  calcMean(fm);
  return 0;
}